package ${package.ServiceImpl};

import ${package.Entity}.${entity};
import ${package.Mapper}.${table.mapperName};
import ${package.Service}.${table.serviceName};
import ${superServiceImplClassPackage};
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lianziyou.chain.common.api.CommonPage;
import com.github.pagehelper.PageHelper;
import org.springframework.util.StringUtils;
import java.util.List;

/**
* <p>
    * ${table.comment!} 服务实现类
    * </p>
*
* @author ${author}
* @since ${date}
*/
@Service
<#if kotlin>
    open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {

    }
<#else>
public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {

    @Override
    public  CommonPage<${entity}> findListByPage(Integer page, Integer limit, String orderBy, QueryWrapper<${entity}> queryWrapper){
        if (StringUtils.isEmpty(orderBy)){
            PageHelper.startPage(page, limit);
        }else {
            PageHelper.startPage(page, limit, orderBy);
        }
        List<${entity}> list = baseMapper.selectList(queryWrapper);
        return CommonPage.restPage(list);
    }
}
</#if>